version 12
set more off

*      McDaniel, Nooruddin, and Shortle 'Divine Boundaries' 2011 Replication Code

   ****************************************************************
   ***                                                          ***
   ***  This file contains the code to generate all tables in   ***
   ***  McDaniel, Nooruddin, and Shortle "Divine Boundaries:    ***
   ***  How Religion Shapes Citizens' Attitudes Towards         ***
   ***  Immigrants." American Politics Research 39 (1): 205-233 ***
   ***															***
   ****************************************************************


* This file is intended for use with the data files 
* "McDanielNooruddinShortle.APR2011.replication PEW data.dta" and
* "McDanielNooruddinShortle.APR2011.replication CCES data.dta".

* Please communicate all errors to Irfan Nooruddin (nooruddin.3@osu.edu).

************************************************************************************
************************************************************************************
************************************************************************************

** TABLES 3 (p. 220) & 4 (p. 221)
*use "McDanielNooruddinShortle.APR2011.replication PEW data.dta", clear

sutex immfear2 imm_selfinterest imm_culture chattend prot_notbornagain prot_bornagain catholic /*
*/ agescl female eduscl incscl employscl partscl ideoscl south countyforeign bordermex if sample==1, minmax

* MODEL 1 IN TABLE 3
xtmixed immfear chattend prot_notbornagain prot_bornagain catholic /*
*/ agescl female eduscl incscl employscl partscl ideoscl south countyforeign bordermex /*
*/ || /*
*/ state:  /*
*/ if sample==1, cov(unstr) mle var
estat ic
* TOP PANEL OF TABLE 4
test prot_notbornagain = prot_bornagain
test prot_notbornagain = catholic
test prot_bornagain = catholic

* MODEL 2 IN TABLE 3
xtmixed imm_selfinterest chattend prot_notbornagain prot_bornagain catholic /*
*/ agescl female eduscl incscl employscl partscl ideoscl south countyforeign bordermex /*
*/ || /*
*/ state:  /*
*/ if sample==1, cov(unstr) mle var
estat ic
* MIDDLE PANEL OF TABLE 4
test prot_notbornagain = prot_bornagain
test prot_notbornagain = catholic
test prot_bornagain = catholic

* MODEL 3 IN TABLE 3
xtmixed imm_culture chattend prot_notbornagain prot_bornagain catholic /*
*/ agescl female eduscl incscl employscl partscl ideoscl south countyforeign bordermex /*
*/ || /*
*/ state:  /*
*/ if sample==1, cov(unstr) mle var
estat ic
* BOTTOM PANEL OF TABLE 4
test prot_notbornagain = prot_bornagain
test prot_notbornagain = catholic
test prot_bornagain = catholic

* TABLE 5 (p. 225)

*use "McDanielNooruddinShortle.APR2011.replication CCES data.dta", clear

sutex immattre immtemp_diff hardcrit softcrit churchattend1 evangelicalProt blackProt catholic jewish /**/ age female educate income1 unemployed Repdummy ideology moralcons southern urban border /*
*/ relnatre churchrelnatre if white==1&newchristian==1, minmax
** MODEL 1: IMMIGRANT ATTITUDES DVreg immattre churchattend1 mainlineProt evangelicalProt blackProt catholic jewish /**/ age female educate income1 unemployed Repdummy ideology moralcons southern urban border if white==1&newchristian==1, r
test mainlineProt = evangelicalProt
test mainlineProt = catholic
test evangelicalProt = catholic
estimates store relnat1
** MODEL 2: IMMIGRANT ATTITUDES DV
reg immattre churchattend1 mainlineProt evangelicalProt blackProt catholic jewish /**/ age female educate income1 unemployed Repdummy ideology moralcons southern urban border relnatre if white==1&newchristian==1, r
test mainlineProt = evangelicalProt
test mainlineProt = catholic
test evangelicalProt = catholic
estimates store relnat2

** END-NOTE 7 (p. 228)
reg immattre churchattend1 mainlineProt evangelicalProt blackProt catholic jewish /**/ age female educate income1 unemployed Repdummy ideology moralcons southern urban border relnatre if white==1, r
reg immattre churchattend1 mainlineProt evangelicalProt blackProt catholic jewish /**/ age female educate income1 unemployed Repdummy ideology moralcons southern urban border relnatre if white==1|hispanic==1, r
** MODEL 3: IMMIGRANT FEELING THERMOMETER DVreg immtemp_diff churchattend1 mainlineProt evangelicalProt blackProt catholic jewish  /**/ age female educate income1 unemployed Repdummy ideology moralcons southern urban border if white==1&newchristian==1, r
test mainlineProt = evangelicalProt
test mainlineProt = catholic
test evangelicalProt = catholic
estimates store relnat3
** MODEL 4: IMMIGRANT FEELING THERMOMETER DV
reg immtemp_diff churchattend1 mainlineProt evangelicalProt blackProt catholic jewish /**/ age female educate income1 unemployed Repdummy ideology moralcons southern urban border relnatre if white==1&newchristian==1, r
test mainlineProt = evangelicalProt
test mainlineProt = catholic
test evangelicalProt = catholic
estimates store relnat4
** END-NOTE 7 (p. 228)
reg immtemp_diff churchattend1 mainlineProt evangelicalProt blackProt catholic jewish /**/ age female educate income1 unemployed Repdummy ideology moralcons southern urban border relnatre if white==1, r
reg immtemp_diff churchattend1 mainlineProt evangelicalProt blackProt catholic jewish /**/ age female educate income1 unemployed Repdummy ideology moralcons southern urban border relnatre if white==1|hispanic==1, r
